home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
funcom 2000 Presskit
/
000721_1312 (fun.com).iso
/
funcom.dir
/
00026_Script_Set Size behavior
< prev
next >
Wrap
Text File
|
2000-07-20
|
2KB
|
61 lines
-- Set Size behavior
-----------------------------------------------------------
-- This behavior sets the size of a shape sprite in
-- response to a sliderMove message from the slider
-- behavior. The message also contains a value between 0
-- and 100 representing the slider's current position.
--
-- You attach this behavior to a shape sprite.
--
-- David Benman 11/97
-----------------------------------------------------------
-- pControlButtonName - The name of the button that
-- controls this behavior
-- pStartWidth - The width of this sprite when the sprite
-- begins
-- pStartLoc - A point representing the starting position
-- of this sprite
property pControlButtonName, pStartWidth, pStartLoc
-- This handler initializes the width, location, and
-- control button properties.
on beginSprite me
set currentSprite to the spriteNum of me
set pStartWidth to the width of sprite currentSprite
set pstartLoc to the loc of sprite the spriteNum of me
set pControlButtonName to "track"
end
-- This handler responds to a sliderMove message by
-- changing the sprite's size. The size changes
-- when the behavior sending the message is the controlling
-- button for this behavior.
on sliderMove me, messageSenderName, ratio
-- Resizes then moves the shape sprite to keep it
-- centered. Scales width and height equally
if messageSenderName = pControlButtonName then
set currentSprite to the spriteNum of me
-- Resizes sprite
set newDimension to pStartWidth + (ratio - 25) * 0.3
set the width of sprite currentSprite to newDimension
set the height of sprite currentSprite to newDimension
-- Centers sprite
set offset to (ratio - 25) * 0.3 * 0.5
set newPoint to point(offset, offset)
set newLoc to pStartLoc - newPoint
set the loc of sprite currentSprite to newLoc
end if
end